const ws = require("ws")

let chat = new ws.Server({ port: 3200 })

console.log("Boss_直拒启动！！！")

chat.on('connection', (client) => {

    client.on("message", (message) => {
        try {
            // 解析JSON对象并获取其中的数据
            var rs = JSON.parse(message);
            console.log(rs)
            chat.clients.forEach(c => {
                c.send(JSON.stringify(rs))
                // c.send(rs)
            })
        } catch (error) {
            console.log("invalid JSON:", error);
        }

    })
})